package com.imooc.SmartChargeStation.demo.netty.handlers;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;

/**
 * author: zpy
 * description: 粘包半包场景复现(服务端接收)
 * date: 2025/8/21
 */

@Slf4j
public class ImoocServerPkgHandler extends SimpleChannelInboundHandler<String> {

    //计数器
    private int count = 0;

    @Override
    protected void channelRead0(
            ChannelHandlerContext channelHandlerContext,
            String msg) throws Exception {


        ++count;
        log.info("粘包半包问题场景复现>>>>>服务端已接收第"+count+"个数据包:"+msg);

    }
}
